define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	
	var Model = function(){
		this.callParent();
		this.progArr = [];
	};

	Model.prototype.saveBtnClick = function(event){
		var value = this.comp("nameInput").val();
		for(var i = 0;i<this.progArr.length;i++){
			if(this.progArr[i] == value){
				justep.Util.hint("该配置名称已存在",{type:"warning"});
				return;
			}
		}
		this.owner.send({progaramName:value});
		this.close();
	};


	Model.prototype.modelParamsReceive = function(event){
		var self = this;
		if(event.params.data){
			event.params.data.forEach(function(item,index){
				self.progArr.push(item.name);
			});
		}
	};


	return Model;
});